﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Bifrost;

namespace TextEditor
{
    public partial class frmUpdateTime : DevComponents.DotNetBar.Office2007Form
    {
        public frmUpdateTime(string timeString, bool hide)
        {
            InitializeComponent();
            App.FormStytleSet(this, false);
            try
            {
                this.txtContent.Enabled = hide;
                string datestring = App.GetTimeString(timeString);
                this.dtpTime.Value = Convert.ToDateTime(datestring);
                this.txtContent.Text = timeString.Substring(datestring.Length, timeString.Length - datestring.Length).Trim();
            }
            catch
            {
                this.txtContent.Text = "";
                this.dtpTime.Value = DateTime.Now;
            }

        }
        public frmUpdateTime(string time, string text_Name, bool hide)
        {
            InitializeComponent();
            App.FormStytleSet(this, false);
            this.txtContent.Enabled = hide;
            try
            {
                this.txtContent.Text = text_Name;
                this.dtpTime.Value = Convert.ToDateTime(time);
            }
            catch
            {
                this.txtContent.Text = "";
                this.dtpTime.Value = DateTime.Now;
            }
        }
        private void btnOk_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        public string TimeString
        {
            get { return this.dtpTime.Value.ToString("yyyy-MM-dd HH:mm"); }
        }

        public string TxtContent
        {
            get { return this.txtContent.Text; }
        }
    }
}